/* Copyright (c) 2004-2024 peigen.info. All rights reserved. */

package info.peigen.hotpot.business.customer.manage.controller;

import info.peigen.hotpot.business.customer.manage.form.CustomerLogManageCreateForm;
import info.peigen.hotpot.business.customer.manage.form.CustomerLogManageEditForm;
import info.peigen.hotpot.business.customer.manage.form.CustomerLogManageSearchForm;
import info.peigen.hotpot.business.customer.manage.info.CustomerLogManageInfo;
import info.peigen.hotpot.business.customer.manage.service.CustomerLogManageService;
import info.peigen.hotpot.common.core.result.PageResult;
import info.peigen.hotpot.common.core.result.manage.WebResult;
import info.peigen.hotpot.component.data.repository.beetlsql.filter.ManageDataAspect;
import org.noear.solon.annotation.Body;
import org.noear.solon.annotation.Controller;
import org.noear.solon.annotation.Inject;
import org.noear.solon.annotation.Mapping;
import org.noear.solon.validation.annotation.Valid;

/**
 * <b>(CustomerLogManageController)</b>
 * 管理后台 "客户登录日志"控制器
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2023-09-08
 */
@SuppressWarnings({"rawtypes", "unused"})
@Valid
@Controller
@Mapping("customerLog")
public class CustomerLogManageController {
    @Inject
    CustomerLogManageService customerLogManageService;

    @Mapping("page")
    @ManageDataAspect
    WebResult page(@Body CustomerLogManageSearchForm form) {
        PageResult<CustomerLogManageInfo> page = customerLogManageService.page(form);
        return WebResult.setSuccessResult().setInfo(page);
    }

    @Mapping("create")
    @ManageDataAspect
    WebResult create(@Body CustomerLogManageCreateForm form) {
        customerLogManageService.create(form);
        return WebResult.setSuccessResult();
    }

    @Mapping("edit")
    @ManageDataAspect
    WebResult edit(@Body CustomerLogManageEditForm form) {
        customerLogManageService.edit(form);
        return WebResult.setSuccessResult();
    }

    @Mapping("remove")
    @ManageDataAspect
    WebResult remove(@Body CustomerLogManageSearchForm form) {
        customerLogManageService.remove(form.getId());
        return WebResult.setSuccessResult();
    }
}
